package cn.edu.xmu.oomall.liquidation.model.bo.liquid.calc;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class LiquidationCalc {
    private final Logger logger = LoggerFactory.getLogger(LiquidationCalc.class);
    private List<BaseLiquidationItem> liquidationItemList;

    public LiquidationCalc(List<BaseLiquidationItem> liquidationItemList) {
        this.liquidationItemList = liquidationItemList;
    }

    public Map<String, Long> calc(CalcInfo calcInfo) {
        Map<String, Long> liquidationMap = new HashMap<>(5);
        for(BaseLiquidationItem liquidationItem : liquidationItemList) {
            Long calcAmount = liquidationItem.calcAmount(calcInfo);
            liquidationMap.put(liquidationItem.getDbFieldName(), calcAmount);
        }
        return liquidationMap;
    }
}
